﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace GroundStation.Views
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class LauncherWindow : Window
    {
        private static LauncherWindow _instance = new LauncherWindow();

        public static LauncherWindow Instance
        {
            get
            {
                return _instance;
            }
        }

        private LauncherWindow()
        {
            InitializeComponent();
            this.DataContext = new ViewModels.MainWindowViewModel();
        }
        private void TextBox_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter&&(chatText.Text!=null && chatText.Text!=""))
            {
                ViewModels.MainWindowViewModel vm = this.DataContext as ViewModels.MainWindowViewModel;
                vm.SendMessageCommand.Execute(null);
            }
                
        }
        private void TextBlock_TargetUpdated(object sender, DataTransferEventArgs e)
        {
            chatScroller.ScrollToBottom();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            
        }
    }
}
